/* ====================================== toast  ====================================== */
import React from 'react'
import { Drawer } from 'antd'
// ===================================================================== 抽屉
const Index = ({ children, site='left', title='抽屉', width='50%', bodyStyle}, ref) => {
	const [ visible, setVisible ] = React.useState()
	
	React.useImperativeHandle( ref, () => ({
		open: () => setVisible(true)
	}))
	
	return (
		<Drawer
			width 			= { width }
			title			= { title }
			placement		= { site }
			closable		= { false }
			visible			= { visible}
			onClose			= { () => setVisible(false) }
			getContainer	= { false}
			style			= {{ position: 'absolute' }}
			headerStyle		= {{padding:10}}
			bodyStyle		= {{ padding:10, ...bodyStyle}}
		>
			{ children }
		</Drawer>
	)
}

export default Index